//
//  MainCollectionViewCell.m
//  YanMusicPlayer
//
//  Created by 1564335 on 15-6-11.
//  Copyright (c) 2015年 胡岩 All rights reserved.
//

#import "MainCollectionViewCell.h"

@implementation MainCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.bgImage = [[UIImageView alloc] init];
        self.bgImage.layer.cornerRadius = 5;
        self.bgImage.layer.masksToBounds = YES;
        [self.contentView addSubview:self.bgImage];
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
    }
    return self;
}


- (void)setMainListModel:(MainListColllectionModel *)MainListModel
{
    _MainListModel = MainListModel;
    [self.bgImage setImageWithURL:[NSURL URLWithString:_MainListModel.pic_url] placeholderImage:[UIImage imageNamed:@"bgImage3"]];
    self.titleLabel.text = _MainListModel.title;
}

- (void)layoutSubviews
{
    self.bgImage.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    self.titleLabel.frame = CGRectMake(0, self.contentView.frame.size.height - 20, self.contentView.frame.size.width, 20);
    self.titleLabel.backgroundColor = [UIColor blackColor];
    self.titleLabel.alpha = 0.7;
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    self.titleLabel.textColor = [UIColor whiteColor];
}

@end
